import { SidebarData } from "@/types";

export const getSidebarData = async (): Promise<SidebarData | undefined> => {
  try {
    const res = await fetch("http://127.0.0.1:8000/sidebar");
    if (!res.ok) throw new Error("接口请求失败");
    const data = await res.json();
    return data;
  } catch (error) {
    console.log("获取侧边栏数据失败", error);
    return undefined;
  }
};